class MethodType:

    def __init__(self, func, obj):
        self.__func__ = func
        self.__self__ = obj

    def __call__(self, *args, **kwargs):
        func = self.__func__
        obj = self.__self__
        print("小白")
        return func(obj, *args, **kwargs)


class ClassMethod:

    def __init__(self, f):
        self.f = f

    def __get__(self, obj, cls=None):
        if cls is None:
            print("旺财")
            cls = type(obj)

        if hasattr(type(self.f), '__get__'):
            print(f"来福，type(self.f) -> {type(self.f)}")
            return self.f.__get__(cls, cls)
        return MethodType(self.f, cls)


class D:

    # 自定义的 classmethod
    @ClassMethod
    def __doc__(cls):
        return f"I love FishC. -- from class {cls.__name__}"


d = D()
result = d.__doc__()
# 来福，type(self.f) -> <class 'function'>
print(result)
# I love FishC. -- from class D
